#pragma once 

#include "helper/sqlite/ActionResult.h"



namespace helper {
namespace sqlite {

class IDB;

class ExecutionResult : public ActionResult{
public:
  static ExecutionResult make_error(const std::error_code & ec){
    return ExecutionResult(ec, nullptr);
  }
  static ExecutionResult make_error(const std::errc &  errc){
    return ExecutionResult(std::make_error_code(errc), nullptr);
  }

  ExecutionResult(const std::error_code & rc, const IDB * db = nullptr);
  ~ExecutionResult() override;

  inline operator bool() const {
    return isOk();
  }
  bool isOk() const override;

  int affectRows() const;


private:
  const IDB * _db;
};

}//namespace sqlite
}//namespace helper
